- Notifications
You must be signed in to change notification settings - Fork 849
/
Copy pathOML4Py Partitioned Model SVM.dsnb
executable file
·1 lines (1 loc) · 24.3 KB
/
OML4Py Partitioned Model SVM.dsnb
1
[{"layout":null,"template":null,"templateConfig":null,"name":"OML4Py Partitioned Model SVM","description":null,"readOnly":false,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":null,"message":[],"enabled":true,"result":{"startTime":1715293158560,"interpreter":"md.low","endTime":1715293158625,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":true,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# OML4Py Partitioned Model","Oracle Machine Learning enables automatically building an ensemble model comprised of multiple sub-models, one for each data partition. Sub-models exist and are used as one model, which results in simplified scoring using the top-level model only. The proper sub-model is chosen by the system based on partition value(s) in the row of data to be scored. Partitioned models achieve potentially better accuracy through multiple targeted models. ","","In this notebook, we build an SVM model to predict the number of years a customer resides at their residence but partitioned on customer gender. The model is then used to predict the target, then predict the target with prediction details. ","","","Copyright (c) 2024 Oracle Corporation ","###### <a href=\"https://oss.oracle.com/licenses/upl/\" onclick=\"return ! window.open('https://oss.oracle.com/licenses/upl/');\">The Universal Permissive License (UPL), Version 1.0<\/a>","---"],"enabled":true,"result":{"startTime":1715293158702,"interpreter":"md.low","endTime":1715293158764,"results":[{"message":"<h1 id=\"oml4py-partitioned-model\">OML4Py Partitioned Model<\/h1>\n<p>Oracle Machine Learning enables automatically building an ensemble model comprised of multiple sub-models, one for each data partition. Sub-models exist and are used as one model, which results in simplified scoring using the top-level model only. The proper sub-model is chosen by the system based on partition value(s) in the row of data to be scored. Partitioned models achieve potentially better accuracy through multiple targeted models.<\/p>\n<p>In this notebook, we build an SVM model to predict the number of years a customer resides at their residence but partitioned on customer gender. The model is then used to predict the target, then predict the target with prediction details.<\/p>\n<p>Copyright (c) 2024 Oracle Corporation<\/p>\n<h6 id=\"the-universal-permissive-license-upl-version-10\"><a href=\"https://oss.oracle.com/licenses/upl/\" onclick=\"return ! window.open('https://oss.oracle.com/licenses/upl/');\">The Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n<hr />\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"For more information ...","message":["%md","","* <a href=\"https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/index.html\" target=\"_blank\">Oracle ADW Documentation<\/a>","* <a href=\"https://github.com/oracle-samples/oracle-db-examples/tree/main/machine-learning\" target=\"_blank\">OML folder on Oracle GitHub<\/a>","* <a href=\"https://www.oracle.com/machine-learning\" target=\"_blank\">OML Web Page<\/a>","* <a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/2/mlpug/shared-settings.html\" target=\"_blank\">OML4Py Partitioned Models Settings<\/a>","* <a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4sql/23/dmcon/intro-oracle-machine-learning-SQL.html#GUID-02417CD8-80E8-4324-9E5E-2BE2DCE29527\" target=\"_blank\">OML Partitioned Models<\/a>"],"enabled":true,"result":{"startTime":1715293158848,"interpreter":"md.low","endTime":1715293158910,"results":[{"message":"<ul>\n<li><a href=\"https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/index.html\" target=\"_blank\">Oracle ADW Documentation<\/a><\/li>\n<li><a href=\"https://github.com/oracle-samples/oracle-db-examples/tree/main/machine-learning\" target=\"_blank\">OML folder on Oracle GitHub<\/a><\/li>\n<li><a href=\"https://www.oracle.com/machine-learning\" target=\"_blank\">OML Web Page<\/a><\/li>\n<li><a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/2/mlpug/shared-settings.html\" target=\"_blank\">OML4Py Partitioned Models Settings<\/a><\/li>\n<li><a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4sql/23/dmcon/intro-oracle-machine-learning-SQL.html#GUID-02417CD8-80E8-4324-9E5E-2BE2DCE29527\" target=\"_blank\">OML Partitioned Models<\/a><\/li>\n<\/ul>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Import libraries and set display options","message":["%python","","import oml","import pandas as pd","","pd.set_option('display.max_rows', 500)","pd.set_option('display.max_columns', 500)","pd.set_option('display.width', 1000)"],"enabled":true,"result":{"startTime":1715293158989,"interpreter":"python.low","endTime":1715293159053,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Prepare CUSTOMER_DEMO dataset using data from the SH schema","message":["%python","","CUSTOMERS = oml.sync(query = 'SELECT CUST_ID, CUST_GENDER, CUST_MARITAL_STATUS, CUST_YEAR_OF_BIRTH, CUST_INCOME_LEVEL, CUST_CREDIT_LIMIT FROM SH.CUSTOMERS')","SUPPLEMENTARY_DEMOGRAPHICS = oml.sync(query = 'SELECT CUST_ID, EDUCATION, AFFINITY_CARD, HOUSEHOLD_SIZE, OCCUPATION, YRS_RESIDENCE, Y_BOX_GAMES FROM SH.SUPPLEMENTARY_DEMOGRAPHICS')","CUSTOMERS_DEMO = CUSTOMERS.merge(SUPPLEMENTARY_DEMOGRAPHICS, how = \"inner\", on = 'CUST_ID', suffixes = [\"\", \"\"])"],"enabled":true,"result":{"startTime":1715293159130,"interpreter":"python.low","endTime":1715293159207,"results":[{"message":"<stdin>:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":8,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Display number of rows and columns","message":["%python","","CUSTOMERS_DEMO.shape"],"enabled":true,"result":{"startTime":1715293159284,"interpreter":"python.low","endTime":1715293159378,"results":[{"message":"(4500, 12)\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":4,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display a few rows of CUSTOMERS_DEMO data","message":["%python","","z.show(CUSTOMERS_DEMO.head())"],"enabled":true,"result":{"startTime":1715293159452,"interpreter":"python.low","endTime":1715293159575,"results":[{"message":"CUST_ID\tCUST_GENDER\tCUST_MARITAL_STATUS\tCUST_YEAR_OF_BIRTH\tCUST_INCOME_LEVEL\tCUST_CREDIT_LIMIT\tEDUCATION\tAFFINITY_CARD\tHOUSEHOLD_SIZE\tOCCUPATION\tYRS_RESIDENCE\tY_BOX_GAMES\n100134\tF\tDivorc.\t1965\tL: 300,000 and above\t9000\tAssoc-A\t0\t2\tCleric.\t2\t0\n102828\tF\tNeverM\t1967\tE: 90,000 - 109,999\t10000\tHS-grad\t0\t1\tMachine\t4\t0\n101232\tM\tNeverM\t1979\tJ: 190,000 - 249,999\t9000\t< Bach.\t0\t1\tOther\t2\t1\n100696\tM\tMarried\t1971\tF: 110,000 - 129,999\t7000\tProfsc\t1\t3\tProf.\t3\t0\n103948\tM\tNeverM\t1966\tJ: 190,000 - 249,999\t9000\t< Bach.\t0\t1\tCleric.\t4\t0\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Create data for training and testing datasets and drop missing values","message":["%python","","dat = CUSTOMERS_DEMO.split(ratio=(0.8, 0.2), seed = 6218945)","","dat[0] = dat[0].dropna()","","train_x = dat[0].drop('YRS_RESIDENCE')","train_y = dat[0]['YRS_RESIDENCE']","test_dat = dat[1]"],"enabled":true,"result":{"startTime":1715293159651,"interpreter":"python.low","endTime":1715293159845,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","### Examples of possible setting overrides for Partitioning (Shared Settings)","","If the user does not override the default settings, then relevant settings are determined by the algorithm","","A complete list of settings can be found in the Documentation link:","","* Algorithm Settings: <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-12408982-E738-4D0F-A2BC-84D895E07ABB\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-12408982-E738-4D0F-A2BC-84D895E07ABB');\">Support Vector Machine<\/a>","","* Shared Settings: <a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/2/mlpug/shared-settings.html#GUID-2EFF3880-F2E2-4449-A8CC-2CF516DD096B\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/2/mlpug/shared-settings.html#GUID-2EFF3880-F2E2-4449-A8CC-2CF516DD096B');\">All algorithms<\/a>","","* Requests the building of a partitioned model. "," The setting value is a comma-separated list of the machine learning attributes to be used to determine the in-list partition key values. These attributes are taken from the input columns, unless an XFORM_LIST parameter is passed to the model. If XFORM_LIST parameter is passed to the model, then the attributes are taken from the attributes produced by these transformations. ","> 'odms_partition_columns' : '<Comma separated list of attributes>'"," ","* Controls the parallel building of partitioned models. "," ODMS_PARTITION_BUILD_INTRA builds each partition in parallel using all slaves."," ODMS_PARTITION_BUILD_INTER builds each partition entirely in a single slave, but multiple partitions may be built at the same time because multiple slaves are active."," ODMS_PARTITION_BUILD_HYBRID combines the other two types and is recommended for most situations to adapt to dynamic environments. This is the default value.","> 'odms_partition_build_type' : 'ODMS_PARTITION_BUILD_HYBRID'"],"enabled":true,"result":{"startTime":1715293159924,"interpreter":"md.low","endTime":1715293159995,"results":[{"message":"<h3 id=\"examples-of-possible-setting-overrides-for-partitioning-shared-settings\">Examples of possible setting overrides for Partitioning (Shared Settings)<\/h3>\n<p>If the user does not override the default settings, then relevant settings are determined by the algorithm<\/p>\n<p>A complete list of settings can be found in the Documentation link:<\/p>\n<ul>\n<li>\n<p>Algorithm Settings: <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-12408982-E738-4D0F-A2BC-84D895E07ABB\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/DBMS_DATA_MINING.html#GUID-12408982-E738-4D0F-A2BC-84D895E07ABB');\">Support Vector Machine<\/a><\/p>\n<\/li>\n<li>\n<p>Shared Settings: <a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/2/mlpug/shared-settings.html#GUID-2EFF3880-F2E2-4449-A8CC-2CF516DD096B\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/machine-learning/oml4py/2/mlpug/shared-settings.html#GUID-2EFF3880-F2E2-4449-A8CC-2CF516DD096B');\">All algorithms<\/a><\/p>\n<\/li>\n<li>\n<p>Requests the building of a partitioned model.\nThe setting value is a comma-separated list of the machine learning attributes to be used to determine the in-list partition key values. These attributes are taken from the input columns, unless an XFORM_LIST parameter is passed to the model. If XFORM_LIST parameter is passed to the model, then the attributes are taken from the attributes produced by these transformations.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>'odms_partition_columns' : '<Comma separated list of attributes>'<\/p>\n<\/blockquote>\n<ul>\n<li>Controls the parallel building of partitioned models.<br />\nODMS_PARTITION_BUILD_INTRA builds each partition in parallel using all slaves.\nODMS_PARTITION_BUILD_INTER builds each partition entirely in a single slave, but multiple partitions may be built at the same time because multiple slaves are active.\nODMS_PARTITION_BUILD_HYBRID combines the other two types and is recommended for most situations to adapt to dynamic environments. This is the default value.<\/li>\n<\/ul>\n<blockquote>\n<p>'odms_partition_build_type' : 'ODMS_PARTITION_BUILD_HYBRID'<\/p>\n<\/blockquote>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"raw","title":"Build Partitioned Model using the SVM algorithm to predict YRS_RESIDENCE, partitioned by CUST_GENDER","message":["%python","","try:"," oml.drop(model = 'SVM_PARTITIONED_REGRESSION_MODEL') ","except:"," pass","","setting = {'svms_kernel_function' :'dbms_data_mining.svms_linear',"," 'odms_partition_columns':'CUST_GENDER'}"," ","svm_mod = oml.svm(\"regression\", **setting)"," ","svm_mod.fit(train_x, train_y , model_name = 'SVM_PARTITIONED_REGRESSION_MODEL')"],"enabled":true,"result":{"startTime":1715293160084,"interpreter":"python.low","endTime":1715293161283,"results":[{"message":"\nModel Name: SVM_PARTITIONED_REGRESSION_MODEL\n\nModel Owner: OMLUSER\n\nAlgorithm Name: Support Vector Machine\n\nMining Function: REGRESSION\n\nTarget: YRS_RESIDENCE\n\nSettings: \n setting name setting value\n0 ALGO_NAME ALGO_SUPPORT_VECTOR_MACHINES\n1 ODMS_DETAILS ODMS_ENABLE\n2 ODMS_MAX_PARTITIONS 1000\n3 ODMS_MISSING_VALUE_TREATMENT ODMS_MISSING_VALUE_AUTO\n4 ODMS_PARTITION_COLUMNS CUST_GENDER\n5 ODMS_SAMPLING ODMS_SAMPLING_DISABLE\n6 PREP_AUTO ON\n7 SVMS_CONV_TOLERANCE .0001\n8 SVMS_EPSILON .1\n9 SVMS_KERNEL_FUNCTION SVMS_LINEAR\n\nComputed Settings: \n partition name setting name setting value\n0 F SVMS_COMPLEXITY_FACTOR 3\n1 F SVMS_NUM_ITERATIONS 30\n2 F SVMS_SOLVER SVMS_SOLVER_IPM\n3 M SVMS_COMPLEXITY_FACTOR 3\n4 M SVMS_NUM_ITERATIONS 30\n5 M SVMS_SOLVER SVMS_SOLVER_IPM\n\nGlobal Statistics: \n partition name attribute name attribute value\n0 F CONVERGED YES\n1 F ITERATIONS 15\n2 F NUM_ROWS 1213\n3 M CONVERGED YES\n4 M ITERATIONS 16\n5 M NUM_ROWS 2381\n\nAttributes: \nAFFINITY_CARD\nCUST_CREDIT_LIMIT\nCUST_GENDER\nCUST_ID\nCUST_INCOME_LEVEL\nCUST_MARITAL_STATUS\nCUST_YEAR_OF_BIRTH\nEDUCATION\nHOUSEHOLD_SIZE\nOCCUPATION\nY_BOX_GAMES\n\nPartition: YES\n\n\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Predict on the test set and display prediction result - note the use of the top level model only","message":["%python","","y_pred_part = svm_mod.predict(test_dat, test_dat)","","z.show(y_pred_part[['PARTITION_NAME', 'PREDICTION'] + y_pred_part.columns].round(4).head())"],"enabled":true,"result":{"startTime":1715293161357,"interpreter":"python.low","endTime":1715293161628,"results":[{"message":"PARTITION_NAME\tPREDICTION\tCUST_ID\tCUST_GENDER\tCUST_MARITAL_STATUS\tCUST_YEAR_OF_BIRTH\tCUST_INCOME_LEVEL\tCUST_CREDIT_LIMIT\tEDUCATION\tAFFINITY_CARD\tHOUSEHOLD_SIZE\tOCCUPATION\tYRS_RESIDENCE\tY_BOX_GAMES\tPREDICTION\tPARTITION_NAME\nF\t4.3611\t100134\tF\tDivorc.\t1965\tL: 300,000 and above\t9000\tAssoc-A\t0\t2\tCleric.\t2\t0\t4.3611\tF\nF\t3.4255\t102828\tF\tNeverM\t1967\tE: 90,000 - 109,999\t10000\tHS-grad\t0\t1\tMachine\t4\t0\t3.4255\tF\nM\t3.1581\t103401\tM\tDivorc.\t1975\tI: 170,000 - 189,999\t10000\tHS-grad\t0\t2\tCrafts\t4\t1\t3.1581\tM\nM\t3.6503\t104077\tM\tNeverM\t1975\tL: 300,000 and above\t9000\tProfsc\t0\t2\tProf.\t3\t1\t3.6503\tM\nM\t1.9144\t101940\tM\tNeverM\t1981\tJ: 190,000 - 249,999\t7000\t< Bach.\t0\t1\t?\t2\t1\t1.9144\tM\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Show model global statistics for each partitioned sub-model","message":["%python","z.show(svm_mod.global_stats)"],"enabled":true,"result":{"startTime":1715293161705,"interpreter":"python.low","endTime":1715293161782,"results":[{"message":"partition name\tattribute name\tattribute value\nF\tCONVERGED\tYES\nF\tITERATIONS\t15.0F\tNUM_ROWS\t1213.0\nM\tCONVERGED\tYES\nM\tITERATIONS\t16.0\nM\tNUM_ROWS\t2381.0\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":7,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Materialize the test dataset","message":["%python","","try:"," oml.drop(table = 'TEST_DATA')","except:"," pass","_ = test_dat.materialize(table = 'TEST_DATA')"],"enabled":true,"result":{"startTime":1715293161855,"interpreter":"python.low","endTime":1715293162178,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":5,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display prediction details","message":["%python","","y_pred_part = svm_mod.predict(test_dat, "," supplemental_cols = test_dat[['CUST_ID', 'YRS_RESIDENCE']], "," topN_attrs = True)"," ","z.show(y_pred_part.head())"],"enabled":true,"result":{"startTime":1715293162253,"interpreter":"python.low","endTime":1715293167159,"results":[{"message":"PARTITION_NAME\tCUST_ID\tYRS_RESIDENCE\tPREDICTION\tNAME_1\tVALUE_1\tWEIGHT_1\tNAME_2\tVALUE_2\tWEIGHT_2\tNAME_3\tVALUE_3\tWEIGHT_3\tNAME_4\tVALUE_4\tWEIGHT_4\tNAME_5\tVALUE_5\tWEIGHT_5\nF\t103200\t3\t3.5245890391003205\tCUST_MARITAL_STATUS\tDivorc.\t.108\tEDUCATION\tAssoc-A\t.101\tCUST_INCOME_LEVEL\tF: 110,000 - 129,999\t.095\tY_BOX_GAMES\t0\t.011\tCUST_CREDIT_LIMIT\t5000\t-.006\nF\t103600\t1\t2.349263509449977\tCUST_CREDIT_LIMIT\t9000\t.002\tY_BOX_GAMES\t1\t-.013\tAFFINITY_CARD\t0\t-.02\tOCCUPATION\tSales\t-.075\tHOUSEHOLD_SIZE\t6-8\t-.114\nF\t100007\t5\t4.09247311406186\tCUST_YEAR_OF_BIRTH\t1963\t.319\tCUST_INCOME_LEVEL\tL: 300,000 and above\t.128\tCUST_MARITAL_STATUS\tDivorc.\t.126\tY_BOX_GAMES\t0\t.013\tCUST_CREDIT_LIMIT\t9000\t.004\nF\t100041\t2\t1.765930950259441\tCUST_INCOME_LEVEL\tL: 300,000 and above\t.049\tCUST_CREDIT_LIMIT\t15000\t.007\tY_BOX_GAMES\t1\t-.009\tAFFINITY_CARD\t0\t-.013\tOCCUPATION\tHandler\t-.141\nF\t100077\t4\t4.138059998358802\tCUST_YEAR_OF_BIRTH\t1959\t.397\tCUST_INCOME_LEVEL\tK: 250,000 - 299,999\t.086\tCUST_MARITAL_STATUS\tMarried\t.062\tCUST_CREDIT_LIMIT\t15000\t.01\tY_BOX_GAMES\t0\t.007\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Demonstrate using the SQL interface so score data and display prediction details","message":["%sql","","SELECT CUST_ID,"," round(PREDICTION_YRS_RES,3) PRED_YRS_RES,"," RTRIM(TRIM(SUBSTR(OUTPRED.\"Attribute1\",17,100)),'rank=\"1\"/>') FIRST_ATTRIBUTE,"," RTRIM(TRIM(SUBSTR(OUTPRED.\"Attribute2\",17,100)),'rank=\"2\"/>') SECOND_ATTRIBUTE","FROM (SELECT CUST_ID,"," PREDICTION(SVM_PARTITIONED_REGRESSION_MODEL USING *) PREDICTION_YRS_RES,"," PREDICTION_DETAILS(SVM_PARTITIONED_REGRESSION_MODEL USING *) PD"," FROM TEST_DATA"," WHERE CUST_ID < 100015"," ORDER BY CUST_ID) OUT,"," XMLTABLE('/Details'"," PASSING OUT.PD"," COLUMNS "," \"Attribute1\" XMLType PATH 'Attribute[1]',"," \"Attribute2\" XMLType PATH 'Attribute[2]') "," OUTPRED"],"enabled":true,"result":{"startTime":1715293167236,"interpreter":"sql.low","endTime":1715293167331,"results":[{"message":"CUST_ID\tPRED_YRS_RES\tFIRST_ATTRIBUTE\tSECOND_ATTRIBUTE\n100007\t4.092\t\"CUST_YEAR_OF_BIRTH\" actualValue=\"1963\" weight=\".319\" \t\"CUST_INCOME_LEVEL\" actualValue=\"L: 300,000 and above\" weight=\".128\" \n100010\t2.978\t\"CUST_CREDIT_LIMIT\" actualValue=\"9000\" weight=\".004\" \t\"CUST_ID\" actualValue=\"100010\" weight=\"-.001\" \n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","## End of Script"],"enabled":true,"result":{"startTime":1715293167407,"interpreter":"md.low","endTime":1715293167471,"results":[{"message":"<h2 id=\"end-of-script\">End of Script<\/h2>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":[],"enabled":true,"result":{"startTime":1715293167565,"interpreter":"md.low","endTime":1715293167627,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":true,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"6","snapshot":false,"tags":null}]